import axios from 'axios';

const API_BASE_URL = 'http://localhost:3000'; 

const api = axios.create({
  baseURL: API_BASE_URL,
});

const list = {
    getlist: (id) => `/sysclassify/${id}`,
    updateList : (id) => `/sysclassify/${id}`,
    deleteList: (id) => `/sysclassify/${id}`,
    gettotal : (id) => `/sysclassify/${id}`,
    addlist: (id) => `/sysclassify/${id}`,
    upload : () => `/shop/upload`
}

const getlist = (id)=>{
    return api.get(list.getlist(id))
}
const updateList = (id,data)=>{
    return api.post(list.updateList(id),data)
}
const deleteList = (id)=>{
    return api.get(list.deleteList(id))
}
const gettotal = (id)=>{
    return api.get(list.gettotal(id))
}
const addlist = (id,data)=>{
    return api.post(list.addlist(id),data)
}
const uploadimg = (data,config)=>{
    return api.post(list.upload(),data,config)
        
}
export {getlist,updateList,deleteList,gettotal,addlist,uploadimg}